using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;
using SalesPages.DomainModel;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class SEOTagContent_lnkMap : EntityTypeConfiguration<SEOTagContent_lnk>
    {
        public SEOTagContent_lnkMap()
        {
            // Primary Key
            this.HasKey(t => new { t.SEOTag_id, t.SEOContent_id, t.IsNewSEO, t.InsertDate, t.UpdateDate });

            // Properties
            this.Property(t => t.SEOTag_id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.SEOContent_id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Url)
                .HasMaxLength(150);

            // Table & Column Mappings
            this.ToTable("SEOTagContent_lnk");
            this.Property(t => t.SEOTag_id).HasColumnName("SEOTag_id");
            this.Property(t => t.SEOContent_id).HasColumnName("SEOContent_id");
            this.Property(t => t.IsNewSEO).HasColumnName("IsNewSEO");
            this.Property(t => t.Url).HasColumnName("Url");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
            this.Property(t => t.TableSource).HasColumnName("TableSource");

            // Relationships
            this.HasRequired(t => t.SEOTag)
                .WithMany(t => t.SEOTagContent_lnk)
                .HasForeignKey(d => d.SEOTag_id);

        }
    }
}
